package com.huanletao.proxy.cglib;

import net.sf.cglib.proxy.MethodProxy;

/**
 * <p>
 * </p>
 * package: com.huanletao.proxy.cglib
 * description:
 * className: CGlibMethodInvocation
 * author:  踏雪无痕
 * copyright: Copyright (c) 2022/9/25 10:16
 * since: 1.0.0
 */
public class CGlibMethodInvocation implements MethodInvocation {
    private final Object[] args;
    private final MethodProxy methodProxy;
    private final Object target;

    public CGlibMethodInvocation(Object[] args, MethodProxy methodProxy, Object target) {
        this.args = args;
        this.methodProxy = methodProxy;
        this.target = target;
    }

    @Override
    public Object[] getArguments() {
        return args;
    }

    @Override
    public Object proceed() throws Throwable {
        return methodProxy.invokeSuper(target, args);
    }
}
